#if !defined(AFX_DLGGROUPPIPE_H__2FDAD2AB_7DDD_4E6F_B018_AA958A81DDBA__INCLUDED_)
#define AFX_DLGGROUPPIPE_H__2FDAD2AB_7DDD_4E6F_B018_AA958A81DDBA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgGroupPipe.h : header file
//

#include "GroupPipeInfo.h"
#include "UeList.h"
/////////////////////////////////////////////////////////////////////////////
// CDlgGroupPipe dialog

//group pipes align style
#define TOP_ALIGN    0      
#define CENTER_ALIGN 1 
#define BOTTOM_ALIGN 2  

class CDlgGroupPipe : public CDialog
{
// Construction
public:
	CDlgGroupPipe(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgGroupPipe();

// Dialog Data
	//{{AFX_DATA(CDlgGroupPipe)
	enum { IDD = IDD_GROUP_PIPE };
	CCheckListBox m_ctrlPipesInfoList;
	CString	m_strBasePipeSN;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDlgGroupPipe)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(CDlgGroupPipe)
	virtual BOOL OnInitDialog();
	afx_msg void OnBtnAdd();
	afx_msg void OnBtnEdit();
	afx_msg void OnBtnDel();
	afx_msg void OnListChkChange();
	virtual void OnOK();
	afx_msg void OnDblclkListPipesInfo();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

protected:
	void AddNewGroupPipeToMap(CString strKey);
	void DelGroupPipeFromMap(CString strKey);
	void DelAllGroupPipeInMap(CMapStringToOb &map);
	bool GetGroupPipeFromMap(CString strKey, CGroupPipeInfo*& pGp);
	bool SetDisToGroupPipe(CString strSN, double dbNearDis);
	bool GetDisFromGroupPipe(CString strSN, double &dbNearDis);
	bool SetParaToGroupPipe(CString strSN, CUeList lstPipePara);
	bool GetParaFromGroupPiep(CString strSN, CUeList &lstPipePara);
//	bool ChangeAllGroupPipeDis(int iIndex);

	//check list box
	CString GetSNFromListBox(int iIndex);
	void SetSNToListBox(int iIndex, CString strSN);
	double GetDisFromListBox(int iIndex);
	void SetDisToListBox(int iIndex, double dbDis);
	bool ChangePipeInfoInList(int iIndex, CString strPipeInfo);

	//
	void SetPipeSNArray(void);
	void SetBasePipeSN(void);

	//displacement
	double CalFirstPipeBaseDis(void);  //calculate first pipe's displacement away from base pipe
	void CalAllPipeBaseDis(void);  //calculate all pipes' displacement away from base pipe


public:
	bool Set();
	void Show();

	void GetGroupPipeMap(CMapStringToOb &mapGroupPipe);
	void GetPipeSNArray(CStringArray &arrPipeSN);
	CString GetBasePipeSN(void);
	int GetGroupPipeAlignStyle(void);

private:
	CString m_strWindowText;
	bool m_bModeSet;
	
	CMapStringToOb	m_mapGroupPipe;  //all pipes' info
	CStringArray m_arrPipeSN;        //the array of pipe's SN

	int m_iPipeCount;
	int m_iIndexBasePipe; //base pipe's index in the list box

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGGROUPPIPE_H__2FDAD2AB_7DDD_4E6F_B018_AA958A81DDBA__INCLUDED_)
